let defaultCity = '北京'
try {
  if (localStorage.city) {
    defaultCity = localStorage.city
  }
} catch (e) {}

const cityChange = {
  state: {
    city: defaultCity
  },
  mutations: {
    cityChange (state, city) {
      state.city = city
      try {
        localStorage.city = city
      } catch (e) {
      }
    }
  },
  actions: {
    hotCityChange ({commit}, val) {
      commit('cityChange', val)
    }
  }
}
export default cityChange
